package com.tanhua.admin.module.dynamicmanage.controller;

import cn.hutool.core.util.ObjectUtil;
import com.tanhua.admin.module.dynamicmanage.service.impl.MessageDetailsServiceImpl;
import com.tanhua.admin.module.dynamicmanage.vo.YzcMessagesVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/manage")
public class MessageDetailsController {
    @Autowired
    private MessageDetailsServiceImpl messageDetailsService;

    @GetMapping("/messages/{id}")
    public ResponseEntity<Object> messageDetails(@PathVariable("id") String id){
        YzcMessagesVo yzcMessagesVo = messageDetailsService.messageDetails(id);
        if (ObjectUtil.isEmpty(yzcMessagesVo)){
            return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("fuck you");
        }
        return ResponseEntity.ok(yzcMessagesVo);
    }
}
